package main

import (
	"log"

	"github.com/labstack/echo"
	"gopkg.in/ini.v1"

	"myproject/wx_test/src/wxact"
	"myproject/wx_test/src/wxglob"
)

var wx *echo.Echo //实例化echo

func main() {
	log.SetFlags(log.Lshortfile)

	var err error
	wxglob.Config, err = ini.Load("./config.ini")
	if err != nil {
		log.Println(err)
		return
	}

	wx = echo.New()
	wx.HideBanner = true //隐藏启动时的banner

	setRouter()

	go wxact.GetAccToken()

	wx.Start(":10080")
}

func setRouter() {
	var resp wxact.Resp
	wx.GET("/wx", resp.HandleFunc)

	wx.POST("/wx", resp.Response)
}
